﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Twi.DataAccess.Common;

namespace Twi.COMMON.Module
{
    /*
     * Copyright: ©2013 Tyingsoft
     * Create By:xuzhihong
     * Create Date: 2013-10-14
     * Description: 快速使用TwiModuleHelper抽象类的初始化条件
     */
    
    public class AnyConnInitConfig
    {
        public  AnyConnInitConfig()
        {
            ConfigConnectionString = "DefaultConnectionString";
            MappingTableName = "TTableMapping";
            MaxCode = new DBMaxCode();
        }
        /// <summary>
        /// 数据库连接字符串（connectionStrings节点）的name值
        /// </summary>
        public string ConfigConnectionString
        {
            get;
            set;
        }

        /// <summary>
        /// 存储表映射的表名
        /// </summary>
        public string MappingTableName
        {
            get;
            set;
        }

        /// <summary>
        /// SQL-MAP 配置文件的完整路径
        /// </summary>
        public string SQLMapFullPath
        {
            get;
            set;
        }

        /// <summary>
        /// 最大记录编号存储信息
        /// </summary>
        public DBMaxCode MaxCode
        {
            get;
            set;
        }

        /// <summary>
        /// 配置文件的虚拟路径。如："/Areas/BIM/Views"
        /// 如果为 null，则打开根 Web.config 文件.
        /// </summary>
        public string WebConfigPath
        {
            get;
            set;
        }

        /// <summary>
        /// 添加后缀（如：BIM-->BIMConnectionString）
        /// </summary>
        /// <param name="code"></param>
        /// <returns></returns>
        public static string AddPostfix(string code)
        {
            return string.IsNullOrEmpty(code) ? null : code + "ConnectionString";
        }
    }
}
